package com.tutorialspoint;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class MainApp {
    /**
     * Application Context 是 BeanFactory 的子接口，也被成为 Spring 上下文
     */
    public static void main(String[] args) {
        //spring入门helloWorld
        ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
        HelloWorld obj = (HelloWorld) context.getBean("helloWorld");
        obj.getMessage();

//        fileContext();
    }

    /**
     * FileSystemXmlApplicationContext
     */
    private static void fileContext() {
        System.out.println("FileSystemXmlApplicationContext>>>>>>>>>>>>>>>>>>>>");
        ApplicationContext context = new FileSystemXmlApplicationContext("D:/java/code/springOne/srcBeans.xml");
        HelloWorld obj = (HelloWorld) context.getBean("helloWorld");
        obj.getMessage();
    }

}
